<!DOCTYPE html>



  


<html class="theme-next pisces use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<!-- modify by zhangwei -->
<!-- 百度站长 -->
<meta name="baidu-site-verification" content="MdPKZBgY0U">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">



  <meta name="google-site-verification" content="8DKRuNxJDPU2k6cNyVhLe_eSqGk-R8oiYk8iKMg5gwI">














  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/uploads/favicon.ico?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/uploads/favicon.ico?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/uploads/favicon.ico?v=5.1.4">


  <link rel="mask-icon" href="/uploads/favicon.ico?v=5.1.4" color="#222">





  <meta name="keywords" content="AndroidStudio,gradle,">





  <link rel="alternate" href="/atom.xml" title="班德尔城" type="application/atom+xml">






<meta name="description" content="AndroidStudio统一管理gradle编译脚本">
<meta name="keywords" content="AndroidStudio,gradle">
<meta property="og:type" content="article">
<meta property="og:title" content="AndroidStudio统一管理gradle脚本">
<meta property="og:url" content="https://tiimor.cn/AndroidStudio统一管理gradle脚本/index.html">
<meta property="og:site_name" content="班德尔城">
<meta property="og:description" content="AndroidStudio统一管理gradle编译脚本">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="http://cdn.tiimor.cn/images/%E5%94%AF%E7%BE%8E%E7%AF%87%EF%BC%8D%E5%9C%A8%E4%B9%8E%E5%B1%B1%E6%B0%B4%E4%B9%8B%E9%97%B4%E4%B9%9F.jpg">
<meta property="og:image" content="https://github.com/VeiZhang/build.gradle/blob/master/images/config.gradle.png?raw=true">
<meta property="og:image" content="https://github.com/VeiZhang/build.gradle/blob/master/images/config引用.png?raw=true">
<meta property="og:image" content="https://github.com/VeiZhang/build.gradle/blob/master/images/config使用.png?raw=true">
<meta property="og:image" content="https://github.com/VeiZhang/build.gradle/blob/master/images/%E8%BF%9C%E7%A8%8B%E9%85%8D%E7%BD%AE%E5%BC%95%E7%94%A8.png?raw=true">
<meta property="og:image" content="https://github.com/VeiZhang/build.gradle/blob/master/images/%E7%BB%A7%E6%89%BF%E6%96%B9%E5%BC%8F.png?raw=true">
<meta property="og:updated_time" content="2019-04-13T02:03:10.809Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="AndroidStudio统一管理gradle脚本">
<meta name="twitter:description" content="AndroidStudio统一管理gradle编译脚本">
<meta name="twitter:image" content="http://cdn.tiimor.cn/images/%E5%94%AF%E7%BE%8E%E7%AF%87%EF%BC%8D%E5%9C%A8%E4%B9%8E%E5%B1%B1%E6%B0%B4%E4%B9%8B%E9%97%B4%E4%B9%9F.jpg">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":true,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '3AUIZWGETM',
      apiKey: '5fcd6d51d892fffe3480c5b37f5fd4fa',
      indexName: 'Tiimor',
      hits: {"per_page":8},
      labels: {"input_placeholder":"搜索","hits_empty":"未发现与「${query}」相关的内容","hits_stats":"${hits} 条相关条目，使用了 ${time} 毫秒"}
    }
  };
</script>



  <link rel="canonical" href="https://tiimor.cn/AndroidStudio统一管理gradle脚本/">





  <title>AndroidStudio统一管理gradle脚本 | 班德尔城</title>
  




<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  ga('create', 'UA-96457043-1', 'auto');
  ga('send', 'pageview');
</script>


  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?abb97f8f68c9e5eb2217d3111c64e696";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

  <!-- modify by zhangwei -->
  <!-- 下雪的动画 -->
  <div class="canvas-snow">
    <canvas id="canvas" style="margin: 0;  padding: 0;top:0; left: 0; right: 0; background: transparent; position: absolute;" width="1366" height="105"></canvas>
      <script>

      var canvasBgImg = {
        start: function () {
          this.canvas = document.getElementById('canvas')
          this.ctx = this.canvas.getContext("2d")
          this.canvas.width = window.innerWidth
          this.canvas.height = 105
          this.starList = []
        },
        drawLine: function (ctx, x1, y1, x2, y2) {
          ctx.beginPath()
          ctx.strokeStyle = '#ffffff'
          ctx.lineTo(x1, y1)
          ctx.lineTo(x2, y2)
          ctx.stroke()
        },
        canvasSingleSnow: function (snowSize) {
          var singleSnow = document.createElement('canvas'),
            ctxSingle = singleSnow.getContext('2d')
          singleSnow.setAttribute('width', snowSize * 2)
          singleSnow.setAttribute('height', snowSize * 2)
          for (var i = 0; i < 6; i++) {
            ctxSingle.save()
            ctxSingle.translate(snowSize, snowSize)
            ctxSingle.rotate(Math.PI * 2 * i / 6)
            this.drawLine(ctxSingle, 0, 0, snowSize, 0)
            ctxSingle.restore()
          }
          return singleSnow
        },
        canvasAllSnow: function (centerSnow) {
          var canvasSnow = document.createElement('canvas'),
            ctxSnow = canvasSnow.getContext('2d'),
            bigSnow = this.canvasSingleSnow(centerSnow),
            smallSnow = this.canvasSingleSnow(centerSnow / 3),
            sizeSnow = centerSnow * 3 / 5,
            rSnow = centerSnow - sizeSnow / 2
          canvasSnow.setAttribute('width', centerSnow * 2)
          canvasSnow.setAttribute('height', centerSnow * 2)
          ctxSnow.drawImage(bigSnow, 0, 0, bigSnow.width, bigSnow.height, 0, 0, centerSnow * 2, centerSnow * 2)
          for (var i = 0; i < 6; i++) {
            ctxSnow.save()
            ctxSnow.translate(centerSnow, centerSnow)
            ctxSnow.rotate(Math.PI * 2 * i / 6)
            ctxSnow.drawImage(smallSnow, 0, 0, smallSnow.width, smallSnow.height, rSnow - sizeSnow / 2,
              -sizeSnow / 2, sizeSnow, sizeSnow)
            ctxSnow.restore()
          }
          return canvasSnow
        },
        init: function () {
          this.start()
          for (var i = 0; i < 75; i++) {
            this.starList.push({
              drawFunc: this.canvasAllSnow(15),
              width: Math.random() * this.canvas.width,
              height: Math.random() * this.canvas.height,
              speed: Math.random() * 1.5 + .5,
              scale: Math.random() * 12 + 5,
              angel: 0
            })
          }
          var self = this,
            loop = function () {
              self.ctx.clearRect(0, 0, self.canvas.width, self.canvas.width)
              for (var i = 0; i < 75; i++) {
                self.ctx.save()
                self.starList[i].height = self.starList[i].height + self.starList[i].speed
                self.starList[i].angel += 2
                self.ctx.translate(self.starList[i].width, self.starList[i].height)
                self.ctx.rotate(self.starList[i].angel * Math.PI / 360)
                self.ctx.translate(-self.starList[i].width, -self.starList[i].height)
                self.ctx.drawImage(self.starList[i].drawFunc, 0, 0,
                  self.starList[i].drawFunc.width, self.starList[i].drawFunc.height,
                  self.starList[i].width - self.starList[i].scale / 2,
                  self.starList[i].height - self.starList[i].scale / 2,
                  self.starList[i].scale, self.starList[i].scale)
                if (self.starList[i].height > self.canvas.height) {
                  self.starList[i] = Object.assign(self.starList[i], {
                    height: -self.starList[i].scale,
                    width: Math.random() * this.canvas.width
                  })
                }
                self.ctx.restore()
              }
              requestAnimationFrame(loop)
            }
          requestAnimationFrame(loop)
        }
      }
      canvasBgImg.init()
      </script>

    </div>


    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <!-- modify by zhangwei -->
        <!-- 圣诞帽 -->
        <img src="/uploads/santa-hat.png" id="santa" style="height: 41px; position: absolute; left: -40px; top: -20px; transform: rotate(-45deg); z-index: 9000;">

        <span class="logo-line-before"><i></i></span>
        <span class="site-title">班德尔城</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">微笑，简单，奋发</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-guestbook">
          <a href="/guestbook" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-send"></i> <br>
            
            留言
          </a>
        </li>
      
        
        <li class="menu-item menu-item-favourite">
          <a href="/favourite" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-bookmark"></i> <br>
            
            收藏
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  
  <div class="algolia-popup popup search-popup">
    <div class="algolia-search">
      <div class="algolia-search-input-icon">
        <i class="fa fa-search"></i>
      </div>
      <div class="algolia-search-input" id="algolia-search-input"></div>
    </div>

    <div class="algolia-results">
      <div id="algolia-stats"></div>
      <div id="algolia-hits"></div>
      <div id="algolia-pagination" class="algolia-pagination"></div>
    </div>

    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
  </div>




    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://tiimor.cn/AndroidStudio统一管理gradle脚本/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Tiimor">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/uploads/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="班德尔城">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">AndroidStudio统一管理gradle脚本</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2018-06-01T11:10:02+08:00">
                2018-06-01
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Android联盟/" itemprop="url" rel="index">
                    <span itemprop="name">Android联盟</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/AndroidStudio统一管理gradle脚本/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count gitment-comments-count" data-xid="/AndroidStudio统一管理gradle脚本/" itemprop="commentsCount"></span>
                </a>
              </span>
            
          

          
          
             <span id="/AndroidStudio统一管理gradle脚本/" class="leancloud_visitors" data-flag-title="AndroidStudio统一管理gradle脚本">
               <span class="post-meta-divider">|</span>
               <!-- modify by zhangwei -->
               <!-- 去掉阅读的眼睛图标，阅读次数改为℃ -->
			   
                 <span class="post-meta-item-text">热度 </span>
               
                 <span class="leancloud-visitors-count"></span>
				 <span>℃</span>
             </span>
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p><img src="http://cdn.tiimor.cn/images/%E5%94%AF%E7%BE%8E%E7%AF%87%EF%BC%8D%E5%9C%A8%E4%B9%8E%E5%B1%B1%E6%B0%B4%E4%B9%8B%E9%97%B4%E4%B9%9F.jpg" alt="Android" title="&#x5728;&#x4E4E;&#x5C71;&#x6C34;&#x4E4B;&#x95F4;&#x4E5F;"></p>
<p><a href="https://github.com/VeiZhang/build.gradle" target="_blank" rel="noopener">AndroidStudio&#x7EDF;&#x4E00;&#x7BA1;&#x7406;gradle&#x7F16;&#x8BD1;&#x811A;&#x672C;</a></p>
<a id="more"></a>
<h2 id="&#x76EE;&#x7684;"><a href="#&#x76EE;&#x7684;" class="headerlink" title="&#x76EE;&#x7684;"></a>&#x76EE;&#x7684;</h2><p><strong>&#x5F53;&#x5DE5;&#x7A0B;&#x96C6;&#x6210;&#x5F88;&#x591A;Modules&#x65F6;&#xFF0C;&#x6BCF;&#x4E2A;Module&#x90FD;&#x6709;&#x4E00;&#x4E2A;build.gradle&#xFF0C;&#x5E76;&#x4E14;&#x5E26;&#x6709;&#x5982;&#x4E0B;&#x91CD;&#x590D;&#x7684;&#x4EE3;&#x7801;&#xFF1B;&#x5BF9;&#x6BCF;&#x4E2A;build.gradle&#x4FEE;&#x6539;&#x5F88;&#x9EBB;&#x70E6;&#xFF0C;&#x56E0;&#x6B64;&#x7EDF;&#x4E00;&#x7BA1;&#x7406;build.gradle&#x6587;&#x4EF6;&#x662F;&#x5FC5;&#x8981;&#x7684;</strong></p>
<figure class="highlight gradle"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// &#x91CD;&#x590D;&#x4EE3;&#x7801;</span></span><br><span class="line">android {</span><br><span class="line">    compileSdkVersion <span class="number">25</span></span><br><span class="line">    buildToolsVersion <span class="string">&quot;25.0.0&quot;</span></span><br><span class="line"></span><br><span class="line">    defaultConfig {</span><br><span class="line">        minSdkVersion <span class="number">15</span></span><br><span class="line">        targetSdkVersion <span class="number">23</span></span><br><span class="line">        versionCode <span class="number">1</span></span><br><span class="line">        versionName <span class="string">&quot;1.0&quot;</span></span><br><span class="line">    }</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="keyword">dependencies</span> {</span><br><span class="line">    <span class="keyword">compile</span> <span class="keyword">fileTree</span>(dir: <span class="string">&apos;libs&apos;</span>, <span class="keyword">include</span>: [<span class="string">&apos;*.jar&apos;</span>])</span><br><span class="line">    testCompile <span class="string">&apos;junit:junit:4.12&apos;</span></span><br><span class="line">    <span class="keyword">compile</span> <span class="string">&apos;com.android.support:appcompat-v7:24.2.1&apos;</span></span><br><span class="line">}</span><br></pre></td></tr></tbody></table></figure>
<ul>
<li><strong>&#x4F18;&#x5316;&#x4EE3;&#x7801;</strong></li>
<li><strong>&#x4F7F;&#x7528;&#x76F8;&#x540C;&#x7684;&#x7F16;&#x8BD1;&#x914D;&#x7F6E;</strong></li>
<li><strong>&#x7EDF;&#x4E00;&#x7BA1;&#x7406;&#x8FDC;&#x7A0B;&#x4F9D;&#x8D56;</strong></li>
<li>&#x51CF;&#x5C11;<code>sync project</code>&#x6B21;&#x6570;</li>
</ul>
<h2 id="&#x672C;&#x5730;&#x914D;&#x7F6E;"><a href="#&#x672C;&#x5730;&#x914D;&#x7F6E;" class="headerlink" title="&#x672C;&#x5730;&#x914D;&#x7F6E;"></a>&#x672C;&#x5730;&#x914D;&#x7F6E;<a name="&#x672C;&#x5730;&#x914D;&#x7F6E;"></a></h2><ul>
<li><p>&#x5728;&#x9879;&#x76EE;&#x6839;&#x76EE;&#x5F55;&#x4E0B;&#x521B;&#x5EFA;config.gradle&#x6587;&#x4EF6;&#xFF0C;&#x4F5C;&#x4E3A;&#x7BA1;&#x7406;&#x914D;&#x7F6E;&#x6587;&#x4EF6;</p>
  <figure class="highlight dart"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> java.text.SimpleDateFormat</span><br><span class="line"><span class="keyword">import</span> java.util.regex.Matcher</span><br><span class="line"><span class="keyword">import</span> java.util.regex.<span class="built_in">Pattern</span></span><br><span class="line"></span><br><span class="line">   ext {</span><br><span class="line">       <span class="comment">// &#x63D2;&#x4EF6;</span></span><br><span class="line">       plugins = [</span><br><span class="line">               application       : <span class="string">&quot;com.android.application&quot;</span>,</span><br><span class="line">               <span class="keyword">library</span>           : <span class="string">&quot;com.android.library&quot;</span>,</span><br><span class="line">               maven             : <span class="string">&quot;com.github.dcendents.android-maven&quot;</span>,</span><br><span class="line">               bintray           : <span class="string">&quot;com.jfrog.bintray&quot;</span>,</span><br><span class="line">               novoda            : <span class="string">&quot;com.novoda.bintray-release&quot;</span>,</span><br><span class="line">               greendao          : <span class="string">&quot;org.greenrobot.greendao&quot;</span>,</span><br><span class="line">               <span class="string">&quot;greendao-gradle&quot;</span> : <span class="string">&quot;org.greenrobot:greendao-gradle-plugin:3.2.2&quot;</span></span><br><span class="line">       ]</span><br><span class="line"></span><br><span class="line">       <span class="comment">// &#x914D;&#x7F6E;</span></span><br><span class="line">       android = [</span><br><span class="line">               <span class="comment"><span class="markdown">/<span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span>&#x539F;&#x751F;&#x914D;&#x7F6E;<span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span>/</span></span></span><br><span class="line">               compileSdkVersion       : <span class="number">25</span>,</span><br><span class="line">               buildToolsVersion       : <span class="string">&quot;25.0.0&quot;</span>,</span><br><span class="line">               minSdkVersion           : <span class="number">17</span>,</span><br><span class="line">               targetSdkVersion        : <span class="number">23</span>,</span><br><span class="line">               versionCode             : getVersionCode(),</span><br><span class="line">               versionName             : getVersionName(),</span><br><span class="line"></span><br><span class="line">               <span class="comment"><span class="markdown">/<span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span>&#x81EA;&#x5B9A;&#x4E49;&#x914D;&#x7F6E;<span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span>/</span></span></span><br><span class="line">               androidSupportSdkVersion: <span class="string">&quot;23.0.0&quot;</span></span><br><span class="line">       ]</span><br><span class="line"></span><br><span class="line">       <span class="comment">// &#x4F9D;&#x8D56;</span></span><br><span class="line">       dependencies = [</span><br><span class="line">               <span class="comment"><span class="markdown">/<span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span>&#x539F;&#x751F;&#x4F9D;&#x8D56;<span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span>/</span></span></span><br><span class="line">               <span class="string">&quot;appcompat-v7&quot;</span>      : <span class="string">&quot;com.android.support:appcompat-v7:<span class="subst">${android[<span class="string">&quot;androidSupportSdkVersion&quot;</span>]}</span>&quot;</span>,</span><br><span class="line">               <span class="string">&quot;support-v4&quot;</span>        : <span class="string">&quot;com.android.support:support-v4:<span class="subst">${android[<span class="string">&quot;androidSupportSdkVersion&quot;</span>]}</span>&quot;</span>,</span><br><span class="line">               <span class="string">&quot;cardview-v7&quot;</span>       : <span class="string">&quot;com.android.support:cardview-v7:<span class="subst">${android[<span class="string">&quot;androidSupportSdkVersion&quot;</span>]}</span>&quot;</span>,</span><br><span class="line">               <span class="string">&quot;recyclerview-v7&quot;</span>   : <span class="string">&quot;com.android.support:recyclerview-v7:<span class="subst">${android[<span class="string">&quot;androidSupportSdkVersion&quot;</span>]}</span>&quot;</span>,</span><br><span class="line">               <span class="string">&quot;design&quot;</span>            : <span class="string">&quot;com.android.support:design:<span class="subst">${android[<span class="string">&quot;androidSupportSdkVersion&quot;</span>]}</span>&quot;</span>,</span><br><span class="line">               <span class="string">&quot;annotations&quot;</span>       : <span class="string">&quot;com.android.support:support-annotations:<span class="subst">${android[<span class="string">&quot;androidSupportSdkVersion&quot;</span>]}</span>&quot;</span>,</span><br><span class="line">               <span class="string">&quot;gridlayout-v7&quot;</span>     : <span class="string">&quot;com.android.support:gridlayout-v7:<span class="subst">${android[<span class="string">&quot;androidSupportSdkVersion&quot;</span>]}</span>&quot;</span>,</span><br><span class="line">               <span class="string">&quot;constraint-layout&quot;</span> : <span class="string">&quot;com.android.support.constraint:constraint-layout:1.0.2&quot;</span>,</span><br><span class="line"></span><br><span class="line">               <span class="comment"><span class="markdown">/<span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span>&#x7B2C;&#x4E09;&#x65B9;&#x4F9D;&#x8D56;<span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span>/</span></span></span><br><span class="line">               <span class="comment">// https://github.com/square/retrofit</span></span><br><span class="line">               <span class="string">&quot;retrofit2&quot;</span>           : <span class="string">&quot;com.squareup.retrofit2:retrofit:2.4.0&quot;</span>,</span><br><span class="line">               <span class="string">&quot;converter-scalars&quot;</span>   : <span class="string">&quot;com.squareup.retrofit2:converter-scalars:2.4.0&quot;</span>,</span><br><span class="line">               <span class="string">&quot;converter-gson&quot;</span>      : <span class="string">&quot;com.squareup.retrofit2:converter-gson:2.4.0&quot;</span>,</span><br><span class="line">               <span class="string">&quot;adapter-rxjava&quot;</span>      : <span class="string">&quot;com.squareup.retrofit2:adapter-rxjava:2.4.0&quot;</span>,</span><br><span class="line">               <span class="string">&quot;adapter-rxjava2&quot;</span>     : <span class="string">&quot;com.squareup.retrofit2:adapter-rxjava2:2.4.0&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/square/okhttp</span></span><br><span class="line">               <span class="string">&quot;okhttp&quot;</span>              : <span class="string">&quot;com.squareup.okhttp3:okhttp:3.11.0&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/greenrobot/greenDAO</span></span><br><span class="line">               <span class="string">&quot;greendao&quot;</span>            : <span class="string">&quot;org.greenrobot:greendao:3.2.2&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/yuweiguocn/GreenDaoUpgradeHelper</span></span><br><span class="line">               <span class="string">&quot;greendao-helper&quot;</span>     : <span class="string">&quot;com.github.yuweiguocn:GreenDaoUpgradeHelper:v2.1.0&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/bumptech/glide</span></span><br><span class="line">               <span class="string">&quot;glide&quot;</span>               : <span class="string">&quot;com.github.bumptech.glide:glide:4.8.0&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/square/picasso</span></span><br><span class="line">               <span class="string">&quot;picasso&quot;</span>             : <span class="string">&quot;com.squareup.picasso:picasso:2.71828&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/facebook/fresco</span></span><br><span class="line">               <span class="string">&quot;fresco&quot;</span>              : <span class="string">&quot;com.facebook.fresco:fresco:1.10.0&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/greenrobot/EventBus</span></span><br><span class="line">               <span class="string">&quot;eventbus&quot;</span>            : <span class="string">&quot;org.greenrobot:eventbus:3.1.1&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/BuglyDevTeam/Bugly-Android</span></span><br><span class="line">               <span class="string">&quot;bugly&quot;</span>               : <span class="string">&quot;com.tencent.bugly:crashreport:2.6.6.1&quot;</span>,</span><br><span class="line">               <span class="string">&quot;bugly-native&quot;</span>        : <span class="string">&quot;com.tencent.bugly:nativecrashreport:3.3.1&quot;</span>,</span><br><span class="line">               <span class="comment">// https://bintray.com/android/android-utils/com.android.volley.volley</span></span><br><span class="line">               <span class="string">&quot;volley&quot;</span>              : <span class="string">&quot;com.android.volley:volley:1.1.1&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/ReactiveX/RxJava</span></span><br><span class="line">               <span class="string">&quot;rxjava&quot;</span>              : <span class="string">&quot;io.reactivex:rxjava:1.3.8&quot;</span>,</span><br><span class="line">               <span class="string">&quot;rxjava2&quot;</span>             : <span class="string">&quot;io.reactivex.rxjava2:rxjava:2.2.2&quot;</span>,</span><br><span class="line">               <span class="string">&quot;rxandroid&quot;</span>           : <span class="string">&quot;io.reactivex:rxandroid:2.1.0&quot;</span>,</span><br><span class="line">               <span class="string">&quot;rxandroid2&quot;</span>          : <span class="string">&apos;io.reactivex.rxjava2:rxandroid:2.0.2&apos;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/JakeWharton/RxBinding</span></span><br><span class="line">               <span class="string">&quot;rxbinding&quot;</span>           : <span class="string">&apos;com.jakewharton.rxbinding2:rxbinding:2.2.0&apos;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/google/gson</span></span><br><span class="line">               <span class="string">&quot;gson&quot;</span>                : <span class="string">&quot;com.google.code.gson:gson:2.8.5&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/apache/commons-lang</span></span><br><span class="line">               <span class="string">&quot;commons-lang3&quot;</span>       : <span class="string">&quot;org.apache.commons:commons-lang3:3.8&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/square/leakcanary</span></span><br><span class="line">               <span class="string">&quot;leakcanary&quot;</span>          : <span class="string">&quot;com.squareup.leakcanary:leakcanary-android:1.6.2&quot;</span>,</span><br><span class="line">               <span class="string">&quot;leakcanary-release&quot;</span>  : <span class="string">&quot;com.squareup.leakcanary:leakcanary-android-no-op:1.6.2&quot;</span>,</span><br><span class="line">               <span class="string">&quot;leakcanary-fragment&quot;</span> : <span class="string">&quot;com.squareup.leakcanary:leakcanary-support-fragment:1.6.2&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/YoKeyword/Fragmentation</span></span><br><span class="line">               <span class="string">&quot;fragmentation&quot;</span>       : <span class="string">&quot;me.yokeyword:fragmentation:1.3.6&quot;</span>,</span><br><span class="line">           </span><br><span class="line">               <span class="comment"><span class="markdown">/<span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span>&#x4E2A;&#x4EBA;&#x4F9D;&#x8D56;<span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span>/</span></span></span><br><span class="line">               <span class="comment">// https://github.com/VeiZhang/BaseToolsLibrary</span></span><br><span class="line">               <span class="string">&quot;basetools&quot;</span>           : <span class="string">&quot;com.excellence:basetools:1.2.6&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/VeiZhang/Permission</span></span><br><span class="line">               <span class="string">&quot;permission&quot;</span>          : <span class="string">&quot;com.excellence:permission:1.0.1&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/VeiZhang/RetrofitClient</span></span><br><span class="line">               <span class="string">&quot;retrofit-client&quot;</span>     : <span class="string">&quot;com.excellence:retrofit:1.0.5&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/VeiZhang/QSkinLoader</span></span><br><span class="line">               <span class="string">&quot;skinloader&quot;</span>          : <span class="string">&quot;com.excellence:skinloader:1.2.2&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/VeiZhang/ToastKit</span></span><br><span class="line">               <span class="string">&quot;toast&quot;</span>               : <span class="string">&quot;com.excellence:toast:1.1.0&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/VeiZhang/MailSender</span></span><br><span class="line">               <span class="string">&quot;mailsender&quot;</span>          : <span class="string">&quot;com.excellence:mailsender:1.0.0&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/VeiZhang/Downloader</span></span><br><span class="line">               <span class="string">&quot;downloader&quot;</span>          : <span class="string">&quot;com.excellence:downloader:1.2.0&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/VeiZhang/AppStatistics</span></span><br><span class="line">               <span class="string">&quot;app-statistics&quot;</span>      : <span class="string">&quot;com.excellence:app-statistics:1.0.1&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/VeiZhang/AndroidExec</span></span><br><span class="line">               <span class="string">&quot;exec&quot;</span>                : <span class="string">&quot;com.excellence:exec:1.1.0&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/VeiZhang/AndroidFFmpeg</span></span><br><span class="line">               <span class="string">&quot;ffmpeg&quot;</span>              : <span class="string">&quot;com.excellence:ffmpeg:1.1.0&quot;</span>,</span><br><span class="line">               <span class="comment">// https://github.com/VeiZhang/ImageLoader</span></span><br><span class="line">               <span class="string">&quot;imageloader&quot;</span>         : <span class="string">&quot;com.excellence:imageloader:1.0.0&quot;</span>,</span><br><span class="line">               <span class="string">&quot;imageloader-fresco&quot;</span>  : <span class="string">&quot;com.excellence:imageloader-fresco:1.0.0&quot;</span>,</span><br><span class="line">               <span class="string">&quot;imageloader-picasso&quot;</span> : <span class="string">&quot;com.excellence:imageloader-picasso:1.0.0&quot;</span>,</span><br><span class="line">               <span class="string">&quot;imageloader-glide&quot;</span>   : <span class="string">&quot;com.excellence:imageloader-glide:1.0.0&quot;</span></span><br><span class="line">       ]</span><br><span class="line">   }</span><br><span class="line"></span><br><span class="line"><span class="comment"><span class="markdown">/<span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">***APP&#x7248;&#x672C;&#x63A7;&#x5236;&#x7684;&#x901A;&#x7528;&#x65B9;&#x6CD5;**</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span>*/</span></span></span><br><span class="line"><span class="comment"><span class="markdown">/**</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> * svn</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> * &#x76F4;&#x63A5;&#x8BFB;&#x53D6;svn&#x7248;&#x672C;&#x53F7;&#x4F5C;&#x4E3A;&#x7248;&#x672C;&#x63A7;&#x5236;</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> */</span></span></span><br><span class="line"><span class="comment"><span class="markdown">/**</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> * git</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> *</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> * git tag&#x4F5C;&#x4E3A;&#x7248;&#x672C;&#x540D;&#x79F0;</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> * git &#x7248;&#x672C;&#x53F7;&#x6709;&#x4E24;&#x79CD;&#x65B9;&#x6CD5;</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> *  &#x2460;&#x7248;&#x672C;&#x53F7;&#x4F5C;&#x4E3A;&#x6211;&#x4EEC;&#x5185;&#x90E8;&#x5F00;&#x53D1;&#x7684;&#x6807;&#x8BC6;&#xFF0C;&#x4E00;&#x822C;&#x5B83;&#x662F;+1&#x9012;&#x589E;&#x7684;&#xFF0C;&#x6BCF;&#x4E00;&#x6B21;&#x53D1;&#x7248;&#x6211;&#x4EEC;&#x5C31;&#x4F1A;&#x6253;&#x4E00;&#x4E2A;tag&#xFF0C;tag&#x7684;&#x6570;&#x91CF;&#x4E5F;&#x4F1A;&#x589E;&#x52A0;1&#x4E2A;&#xFF0C;&#x548C;&#x6211;&#x4EEC;&#x7248;&#x672C;&#x53F7;&#x7684;&#x9012;&#x589E;&#x903B;&#x8F91;&#x662F;&#x7B26;&#x5408;&#x7684;&#xFF0C;tag&#x6570;&#x91CF;+1&#xFF0C;&#x7248;&#x672C;&#x53F7;&#x4E5F;&#x4F1A;&#x8DDF;&#x7740;+1</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> *  &#x2461;&#x8FD8;&#x6709;&#x4E00;&#x79CD;&#x662F;&#x628A;&#x63D0;&#x4EA4;&#x6B21;&#x6570;&#x4F5C;&#x4E3A;versionCode&#xFF0C;&#x4E0D;&#x63A8;&#x8350;&#x3002;&#x76F8;&#x6BD4;&#x8F83;&#x2460;&#xFF0C;&#x2461;&#x6BD4;&#x8F83;&#x96BE;&#x627E;&#xFF0C;&#x56E0;&#x4E3A;tag&#x7684;&#x6570;&#x91CF;&#x4E0D;&#x4F1A;&#x5F88;&#x591A;</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> */</span></span></span><br><span class="line"></span><br><span class="line"><span class="comment"><span class="markdown">/**</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> * &#x83B7;&#x53D6;&#x7248;&#x672C;</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> * @return</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> */</span></span></span><br><span class="line">def getVersionName() {</span><br><span class="line">    def date = getDate()</span><br><span class="line">    def version = getSvnVersionCode()</span><br><span class="line">    <span class="keyword">if</span> (version != <span class="number">0</span>) {</span><br><span class="line">        <span class="keyword">return</span> <span class="string">&quot;1.0.<span class="subst">${version}</span> [<span class="subst">${date}</span>]&quot;</span></span><br><span class="line">    }</span><br><span class="line">    version = getGitTag()</span><br><span class="line">    <span class="keyword">if</span> (version != <span class="number">0</span>) {</span><br><span class="line">        <span class="keyword">return</span> <span class="string">&quot;<span class="subst">${version}</span> [<span class="subst">${date}</span>]&quot;</span></span><br><span class="line">    }</span><br><span class="line">    <span class="keyword">if</span> (version == <span class="number">0</span>) {</span><br><span class="line">        version = <span class="number">1</span></span><br><span class="line">    }</span><br><span class="line">    <span class="comment"><span class="markdown">/**</span></span></span><br><span class="line"><span class="comment"><span class="markdown"><span class="code">     * &#x9519;&#x8BEF;&#x7684;&#x7248;&#x672C;&#x4FE1;&#x606F;&#xFF0C;&#x8BF7;&#x68C0;&#x67E5;</span></span></span></span><br><span class="line"><span class="comment"><span class="markdown"><span class="code">     */</span></span></span></span><br><span class="line">    <span class="keyword">return</span> <span class="string">&quot;0.<span class="subst">${version}</span> [<span class="subst">${date}</span>]&quot;</span></span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="comment"><span class="markdown">/**</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> * &#x83B7;&#x53D6;&#x7248;&#x672C;&#x53F7;</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> * @return</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> */</span></span></span><br><span class="line">def getVersionCode() {</span><br><span class="line">    def versionCode = getSvnVersionCode()</span><br><span class="line">    <span class="keyword">if</span> (versionCode == <span class="number">0</span>) {</span><br><span class="line">        versionCode = getGitVersionCode()</span><br><span class="line">    }</span><br><span class="line">    <span class="keyword">if</span> (versionCode == <span class="number">0</span>) {</span><br><span class="line">        versionCode = <span class="number">1</span></span><br><span class="line">    }</span><br><span class="line">    <span class="keyword">return</span> versionCode</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="comment"><span class="markdown">/<span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">***&#x8BFB;&#x53D6;Git&#x4FE1;&#x606F;**</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span>*/</span></span></span><br><span class="line"></span><br><span class="line"><span class="comment"><span class="markdown">/**</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> * &#x8BFB;&#x53D6;git tag</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> * @return tag</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> */</span></span></span><br><span class="line">def getGitTag() {</span><br><span class="line">    <span class="keyword">try</span> {</span><br><span class="line">        def stdout = <span class="keyword">new</span> ByteArrayOutputStream()</span><br><span class="line">        exec {</span><br><span class="line">            commandLine <span class="string">&apos;git&apos;</span>, <span class="string">&apos;describe&apos;</span>, <span class="string">&apos;--abbrev=0&apos;</span>, <span class="string">&apos;--tags&apos;</span></span><br><span class="line">            standardOutput = stdout</span><br><span class="line">        }</span><br><span class="line">        <span class="keyword">return</span> stdout.toString().split(<span class="string">&quot;\n&quot;</span>)</span><br><span class="line">    } <span class="keyword">catch</span> (e) {</span><br><span class="line">        println e.getMessage()</span><br><span class="line">    }</span><br><span class="line">    <span class="keyword">return</span> <span class="number">0</span></span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="comment"><span class="markdown">/**</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> * &#x4EE5;git tag&#x7684;&#x6570;&#x91CF;&#x4F5C;&#x4E3A;&#x5176;&#x7248;&#x672C;&#x53F7;</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> * @return tag&#x7684;&#x6570;&#x91CF;</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> */</span></span></span><br><span class="line">def getGitVersionCode() {</span><br><span class="line">    <span class="keyword">try</span> {</span><br><span class="line">        def stdout = <span class="keyword">new</span> ByteArrayOutputStream()</span><br><span class="line">        exec {</span><br><span class="line">            commandLine <span class="string">&apos;git&apos;</span>, <span class="string">&apos;tag&apos;</span>, <span class="string">&apos;--list&apos;</span></span><br><span class="line">            standardOutput = stdout</span><br><span class="line">        }</span><br><span class="line">        <span class="keyword">return</span> stdout.toString().split(<span class="string">&quot;\n&quot;</span>).size()</span><br><span class="line">    } <span class="keyword">catch</span> (e) {</span><br><span class="line">        println e.getMessage()</span><br><span class="line">    }</span><br><span class="line">    <span class="keyword">return</span> <span class="number">0</span></span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="comment"><span class="markdown">/<span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">***&#x8BFB;&#x53D6;SVN&#x4FE1;&#x606F;**</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span><span class="strong">*****</span>*/</span></span></span><br><span class="line"></span><br><span class="line"><span class="comment"><span class="markdown">/**</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> * &#x6839;&#x636E;svn&#x63D0;&#x4EA4;&#x7248;&#x672C;&#x751F;&#x6210;&#x7248;&#x672C;&#x53F7;</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> * @return</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> */</span></span></span><br><span class="line">def getSvnVersionCode() {</span><br><span class="line">    <span class="keyword">try</span> {</span><br><span class="line">        def process = (<span class="string">&quot;svnversion -c &quot;</span> + getBuildDir().parent).execute()</span><br><span class="line">        process.waitFor()</span><br><span class="line">        def version = process.<span class="keyword">in</span>.text</span><br><span class="line">        <span class="built_in">Pattern</span> pattern = <span class="built_in">Pattern</span>.compile(<span class="string">&quot;(\\d+:)?(\\d+)\\D&quot;</span>)</span><br><span class="line">        Matcher matcher = pattern.matcher(version)</span><br><span class="line">        <span class="keyword">if</span> (matcher.find()) {</span><br><span class="line">            version = matcher.group(matcher.groupCount())</span><br><span class="line">        }</span><br><span class="line">        <span class="keyword">return</span> Integer.parseInt(version)</span><br><span class="line">    } <span class="keyword">catch</span> (e) {</span><br><span class="line">        println e.getMessage()</span><br><span class="line">    }</span><br><span class="line">    <span class="keyword">return</span> <span class="number">0</span></span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="comment"><span class="markdown">/**</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> * &#x83B7;&#x53D6;&#x65E5;&#x671F;</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> * @return</span></span></span><br><span class="line"><span class="comment"><span class="markdown"> */</span></span></span><br><span class="line">def getDate() {</span><br><span class="line">    <span class="built_in">String</span> date = <span class="keyword">new</span> SimpleDateFormat(<span class="string">&quot;MMddyyyy&quot;</span>).format(<span class="keyword">new</span> Date())</span><br><span class="line">    <span class="keyword">return</span> date</span><br><span class="line">}</span><br></pre></td></tr></tbody></table></figure>
<p>  <img src="https://github.com/VeiZhang/build.gradle/blob/master/images/config.gradle.png?raw=true" alt="config.gradle" title="config.gradle"></p>
</li>
<li><p>&#x5728;&#x9879;&#x76EE;&#x6839;&#x76EE;&#x5F55;&#x7684;build.gradle&#x4E2D;&#x5F15;&#x7528;&#xFF0C;&#x4F9B;&#x5176;&#x4ED6;&#x7684;Module&#x4F7F;&#x7528;</p>
<p>  <strong>&#x6CE8;&#x610F;&#xFF1A;</strong> </p>
<ol>
<li><strong>&#x5982;&#x679C;&#x60F3;&#x4F7F;&#x7528;ext&#x7684;&#x503C;&#xFF0C;&#x5219;&#x53EA;&#x80FD;&#x5728;&#x9879;&#x76EE;&#x6839;&#x76EE;&#x5F55;&#x7684;build.gradle&#x4E2D;&#x5F15;&#x7528;</strong></li>
<li><p>&#x60F3;&#x8BA9;&#x5355;&#x72EC;&#x7684;Module&#x4F7F;&#x7528;&#xFF0C;&#x5219;&#x5728;&#x8BE5;Module&#x7684;build.gradle&#x91CC;&#x5F15;&#x5165;&#xFF0C;&#x4F46;&#x662F;&#x6B64;&#x65F6;&#x4E0D;&#x80FD;&#x4F7F;&#x7528;ext&#x7684;&#x503C;&#xFF0C;&#x5426;&#x5219;&#x4F1A;&#x63D0;&#x793A;&#x65E0;&#x6CD5;&#x627E;&#x5230;&#x201D;Error:Cannot get property &#x2018;xxx&#x2019; on extra properties extension as it does not exist&#x201D;</p>
<figure class="highlight sqf"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">apply</span> <span class="keyword">from</span>: <span class="string">&quot;config.gradle&quot;</span></span><br></pre></td></tr></tbody></table></figure>
<p><img src="https://github.com/VeiZhang/build.gradle/blob/master/images/config&#x5F15;&#x7528;.png?raw=true" alt="config&#x5F15;&#x7528;" title="config&#x5F15;&#x7528;"></p>
</li>
</ol>
</li>
</ul>
<ul>
<li><p>&#x5728;Module&#x76EE;&#x5F55;&#x7684;build.gradle&#x4E2D;&#x4F7F;&#x7528;&#x53D8;&#x91CF;</p>
<p>  <img src="https://github.com/VeiZhang/build.gradle/blob/master/images/config&#x4F7F;&#x7528;.png?raw=true" alt="config&#x4F7F;&#x7528;" title="config&#x4F7F;&#x7528;"></p>
</li>
</ul>
<h2 id="&#x8FDC;&#x7A0B;&#x914D;&#x7F6E;"><a href="#&#x8FDC;&#x7A0B;&#x914D;&#x7F6E;" class="headerlink" title="&#x8FDC;&#x7A0B;&#x914D;&#x7F6E;"></a>&#x8FDC;&#x7A0B;&#x914D;&#x7F6E;</h2><p>&#x8FDC;&#x7A0B;&#x914D;&#x7F6E;&#x914D;&#x7F6E;&#x5176;&#x4ED6;&#x6B65;&#x9AA4;&#x4E0E;<a href="#&#x672C;&#x5730;&#x914D;&#x7F6E;">&#x672C;&#x5730;&#x914D;&#x7F6E;</a>&#x662F;&#x4E00;&#x6837;&#xFF0C;&#x4E0D;&#x540C;&#x7684;&#x662F;&#x5F15;&#x7528;&#x7684;&#x65B9;&#x5F0F;&#xFF0C;&#x5BFC;&#x5165;&#x7684;&#x4E0D;&#x662F;&#x8DEF;&#x5F84;&#x91CC;&#x7684;&#x6587;&#x4EF6;&#xFF0C;&#x800C;&#x662F;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;&#x94FE;&#x63A5;</p>
<figure class="highlight n1ql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">apply from: &quot;https://github.com/VeiZhang/<span class="keyword">build</span>.gradle/blob/master/config.gradle?<span class="keyword">raw</span>=<span class="literal">true</span><span class="string">&quot;</span></span><br></pre></td></tr></tbody></table></figure>
<p><img src="https://github.com/VeiZhang/build.gradle/blob/master/images/%E8%BF%9C%E7%A8%8B%E9%85%8D%E7%BD%AE%E5%BC%95%E7%94%A8.png?raw=true" alt="&#x8FDC;&#x7A0B;&#x914D;&#x7F6E;&#x5F15;&#x7528;" title="&#x8FDC;&#x7A0B;&#x914D;&#x7F6E;&#x5F15;&#x7528;"></p>
<h2 id="&#x7EE7;&#x627F;&#x65B9;&#x5F0F;"><a href="#&#x7EE7;&#x627F;&#x65B9;&#x5F0F;" class="headerlink" title="&#x7EE7;&#x627F;&#x65B9;&#x5F0F;"></a>&#x7EE7;&#x627F;&#x65B9;&#x5F0F;</h2><p>&#x672C;&#x5730;&#x3001;&#x8FDC;&#x7A0B;&#x7684;&#x914D;&#x7F6E;&#x90FD;&#x53EA;&#x662F;&#x4FDD;&#x5B58;&#x4E86;&#x53D8;&#x91CF;&#xFF0C;&#x4F46;&#x662F;&#x5982;&#x679C;&#x60F3;&#x5F15;&#x7528;gradle&#x6587;&#x4EF6;&#x91CC;&#x9762;&#x7684;&#x51FD;&#x6570;&#xFF0C;&#x5176;&#x5B9E;&#x5F88;&#x7B80;&#x5355;&#xFF0C;&#x4E0E;&#x4E0A;&#x9762;&#x662F;&#x76F8;&#x540C;&#x7684;&#x505A;&#x6CD5;&#xFF0C;&#x5FC5;&#x987B;&#x6CE8;&#x610F;&#x7684;&#x662F;&#xFF0C;<strong>apply from:</strong> &#x653E;&#x7F6E;&#x7684;&#x987A;&#x5E8F;&#x5F88;&#x91CD;&#x8981;&#xFF01;</p>
<p><strong>&#x6CE8;&#x610F;</strong>&#xFF1A;&#x5F15;&#x5165;&#x4F4D;&#x7F6E;&#x5728;&#x6587;&#x4EF6;&#x7684;&#x5F00;&#x5934;&#x3001;&#x4E2D;&#x95F4;&#x3001;&#x7ED3;&#x5C3E;&#x7B49;&#x5904;&#x4F7F;&#x7528;&#x3002;&#x56E0;&#x4E3A;gradle&#x811A;&#x672C;&#x7F16;&#x8BD1;&#x662F;&#x987A;&#x5E8F;&#x6267;&#x884C;&#x7684;&#xFF0C;&#x5982;&#x679C;&#x7236;&#x811A;&#x672C;&#x4E0E;&#x5B50;&#x811A;&#x672C;&#x6709;&#x76F8;&#x540C;&#x7684;&#x65B9;&#x6CD5;&#xFF0C;&#x6B64;&#x65F6;&#x7236;&#x811A;&#x672C;&#x5F15;&#x5165;&#x7684;&#x987A;&#x5E8F;&#x5C31;&#x975E;&#x5E38;&#x91CD;&#x8981;&#xFF0C;&#x4E0D;&#x540C;&#x7684;&#x4F4D;&#x7F6E;&#xFF0C;&#x6267;&#x884C;&#x5148;&#x540E;&#x4E0D;&#x4E00;&#x6837;&#x3002;</p>
<p><img src="https://github.com/VeiZhang/build.gradle/blob/master/images/%E7%BB%A7%E6%89%BF%E6%96%B9%E5%BC%8F.png?raw=true" alt="&#x7EE7;&#x627F;&#x65B9;&#x5F0F;" title="&#x7EE7;&#x627F;&#x65B9;&#x5F0F;"></p>
<script>
        document.querySelectorAll('.github-emoji')
          .forEach(el => {
            if (!el.dataset.src) { return; }
            const img = document.createElement('img');
            img.style = 'display:none !important;';
            img.src = el.dataset.src;
            img.addEventListener('error', () => {
              img.remove();
              el.style.color = 'inherit';
              el.style.backgroundImage = 'none';
              el.style.background = 'none';
            });
            img.addEventListener('load', () => {
              img.remove();
            });
            document.body.appendChild(img);
          });
      </script>
      
    </div>
    
    
    

    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>谢谢老板，请尽情用红包来蹂躏我吧！！！</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>赏</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/uploads/wechatpay.jpg" alt="Tiimor 微信打赏">
        <p>微信打赏</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/uploads/alipay.jpg" alt="Tiimor 支付宝打赏">
        <p>支付宝打赏</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <!-- modify by zhangwei -->
            <!-- 文章底部标签图标 -->
            <a href="/tags/AndroidStudio/" rel="tag"><i class="menu-item-icon fa fa-tag fa-fw"></i>AndroidStudio</a>
          
            <!-- modify by zhangwei -->
            <!-- 文章底部标签图标 -->
            <a href="/tags/gradle/" rel="tag"><i class="menu-item-icon fa fa-tag fa-fw"></i>gradle</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/Android二维码生成与扫描/" rel="next" title="Android二维码生成与扫描">
                <i class="fa fa-chevron-left"></i> Android二维码生成与扫描
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/AndroidSDK-原生Settings添加菜单项/" rel="prev" title="AndroidSDK-原生Settings添加菜单项">
                AndroidSDK-原生Settings添加菜单项 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
      
        <div id="gitment-container"></div>
      
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/uploads/avatar.jpg" alt="Tiimor">
            
              <p class="site-author-name" itemprop="name">Tiimor</p>
              <p class="site-description motion-element" itemprop="description">安静地做一只攻城狮。</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">41</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">6</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">56</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          
            <div class="feed-link motion-element">
              <a href="/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/VeiZhang" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i>GitHub</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="http://www.weibo.com/tiimor" target="_blank" title="微博">
                      
                        <i class="fa fa-fw fa-weibo"></i>微博</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://juejin.im/user/589972d0570c3500624fd791" target="_blank" title="掘金">
                      
                        <i class="fa fa-fw fa-anchor"></i>掘金</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="http://www.jianshu.com/u/93b886580243" target="_blank" title="简书">
                      
                        <i class="fa fa-fw fa-book"></i>简书</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="http://wpa.qq.com/msgrd?v=3&uin=690393541&site=qq&menu=yes" target="_blank" title="QQ">
                      
                        <i class="fa fa-fw fa-qq"></i>QQ</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:tiimor@qq.com" target="_blank" title="邮箱">
                      
                        <i class="fa fa-fw fa-envelope"></i>邮箱</a>
                  </span>
                
            </div>
          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#目的"><span class="nav-number">1.</span> <span class="nav-text">目的</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#本地配置"><span class="nav-number">2.</span> <span class="nav-text">本地配置</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#远程配置"><span class="nav-number">3.</span> <span class="nav-text">远程配置</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#继承方式"><span class="nav-number">4.</span> <span class="nav-text">继承方式</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2017 &mdash; <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Tiimor</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Pisces</a></div>




        
<div class="busuanzi-count">
  <!-- modify by zhangwei -->
  <!-- 修改不蒜子统计脚本 -->
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv">
      <i class="fa fa-user"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
      
    </span>
  

  
    <span class="site-pv">
      <i class="fa fa-eye"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
      
    </span>
  
</div>



<script>
  	var _mtac = {};
  	(function() {
  		var mta = document.createElement("script");
  		mta.src = "https://pingjs.qq.com/h5/stats.js?v2.0.4";
  		mta.setAttribute("name", "MTAH5");
  		mta.setAttribute("sid", "500425805");

  		var s = document.getElementsByTagName("script")[0];
  		s.parentNode.insertBefore(mta, s);
  	})();
</script>


  <script type="text/javascript">
    (function() {
      var hm = document.createElement("script");
      hm.src = "//tajs.qq.com/stats?sId=61441764";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
          <span id="scrollpercent"><span>0</span>%</span>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  


  











  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  

  
  
    <script type="text/javascript" src="/lib/canvas-nest/canvas-nest.min.js"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  







<!-- LOCAL: You can save these files to your site and update links -->
    
        
        <link rel="stylesheet" href="https://aimingoo.github.io/gitmint/style/default.css">
        <script src="https://aimingoo.github.io/gitmint/dist/gitmint.browser.js"></script>
    
<!-- END LOCAL -->

    

    
      <script type="text/javascript">
      function renderGitment(){
        var gitment = new Gitmint({
            <!-- modify by zhangwei -->
            <!-- 修复gitment评论页初始化错误@tiimor -->
            id: '1527822602000', 
            owner: 'VeiZhang',
            repo: 'veizhang.github.io',
            
            lang: "" || navigator.language || navigator.systemLanguage || navigator.userLanguage,
            
            oauth: {
            
            
                client_secret: '9919bc61413a89ea3eb156910d282e3103093e32',
            
                client_id: 'f08924ca58e61d6f51f4'
            }});
        gitment.render('gitment-container');
      }

      
      renderGitment();
      
      </script>
    







  




  
  
  
  <link rel="stylesheet" href="/lib/algolia-instant-search/instantsearch.min.css">

  
  
  <script src="/lib/algolia-instant-search/instantsearch.min.js"></script>
  

  <script src="/js/src/algolia-search.js?v=5.1.4"></script>



  

  
  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.4.js"></script>
  <script>AV.initialize("7aBs9I9Y3PjoN6ueX5J3AYQW-gzGzoHsz", "kboycyzaPNAYcUW8AkF3edeW");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>



  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  
  

  

  

  

  
  <!-- modify by zhangwei -->
  <!-- 动态时间小人 -->
  <!-- modify by zhangwei -->
<!-- 动态时间小人 -->
<!-- z-index -1 表示在最底层，不能悬浮也不能点击 -->
<!-- z-index auto 可以点击 -->
<!-- z-index 9999 无限大时，总是在最上层，会影响其他悬浮框 -->
<div id="dg" style="z-index: auto; position: fixed ! important; right: 0px; top: 0px;">  
    <table width 100% style="position: absolute; width:260px; right: 0px; top: 0px;">  
		<div>
			<embed wmode="transparent" src="http://cdn.tiimor.cn/images/dynamic_time.swf" quality="high" bgcolor="#ffffff" width="160" height="70" name="honehoneclock" align="middle" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
		</div>
    </table>  
</div>
  
</body>
</html>
